package com.rq.shuduapp;

public class Row2 {

    private static String rules;
    public int guessIndex = -1;

    public static void setRules(String rules) {
        Row2.rules = rules;
    }

    public String value;
    public String guessValueRes;
    public int x;//位置X
    public int y;//位置Y
    public int sqrX;//块位置X
    public int sqrY;//块位置Y
    public int way;//数据生成方式
    public int writeTime = 0;
    public int sqr = (int) Math.sqrt(rules.length());

    public Row2(String o, int x, int y) {
        if (o.length() == 1) {
            this.writeTime = -1;
            this.value = o;
        } else {
            this.value = "";
            this.guessValueRes = o;
        }
        this.x = x;
        this.y = y;
        this.sqrX = x / sqr;
        this.sqrY = y / sqr;
    }


    public int getWriteTime() {
        return writeTime;
    }

    public String locTxt() {
        return (x + 1) + "," + (y + 1);
    }

    public String loc() {
        return x + "," + y;
    }

    public String sqrLoc() {
        return sqrX + "," + sqrY;
    }

    private int lineIndex() {
        return x * 9 + y;
    }

    public String getValue() {
        return value;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getSqrX() {
        return sqrX;
    }

    public int getSqrY() {
        return sqrY;
    }

    public int getSqrIndex() {
        return sqrX * sqr + sqrY;
    }

    @Override
    public String toString() {
        return "Row2{" +
                "guessIndex=" + guessIndex +
                ", value='" + value + '\'' +
                ", guessValueRes='" + guessValueRes + '\'' +
                ", x=" + x +
                ", y=" + y +
                '}';
    }
}
